<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的增强</title>
</head>
<body>
    
</body>
<script>
    //es5
    const person = {
        name:'hxy',
        age:20,
        run:function(){
            console.log('running')
        }
    }

    //es6 简写
    let name = 'zp'
    let age = 22
    const person2 = {
        name,
        age,
        run(){
            console.log('running')
        },
        walk(){
            console.log('walking')
        }
    }

    //对象的属性是可以用表达式创建的
    obj1 = {
        [name+"newName"]:'Amy',
        [name+"newAge"]:15
    }
    console.log(obj1);

</script>
</html>